# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=kscreen
pkgver=5.27.10
pkgrel=0
pkgdesc="KDE's screen management software"
# armhf blocked by qt5-qtdeclarative
arch="all !armhf"
url="https://kde.org/plasma-desktop/"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
depends="hicolor-icon-theme"
makedepends="
	extra-cmake-modules
	kcmutils5-dev
	kconfig5-dev
	kconfigwidgets5-dev
	kdbusaddons5-dev
	kdeclarative5-dev
	kglobalaccel5-dev
	ki18n5-dev
	kiconthemes5-dev
	kwidgetsaddons5-dev
	kxmlgui5-dev
	layer-shell-qt-dev
	libkscreen-dev
	plasma-framework5-dev
	qt5-qtbase-dev
	qt5-qtsensors-dev
	samurai
	"
checkdepends="xvfb-run"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/kscreen.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/kscreen-$pkgver.tar.xz"
subpackages="$pkgname-lang"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# kscreen-kded-configtest is broken
	# kscreen-kded-osdtest hangs
	xvfb-run ctest --test-dir build --output-on-failure -E "kscreen-kded-(config|osd)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
f63541c54ab4dc4366312b82596e8a2e70b2245d4f22da7e5292e481d57e829784a4662be5021932b7f3375b72dac93c1c504e13ad6fc6a7002bf37fda72316b  kscreen-5.27.10.tar.xz
"
